package cn.appsys.web.controller;

import cn.appsys.pojo.BackendUser;
import cn.appsys.service.BackendUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * Created by asus on 2017/10/15.
 */
@Controller
@RequestMapping("/backendvuser")
public class BackendUserController {
    @Autowired
    private BackendUserService backendUserService;

    /**
     * 管理页面的登录
     * @param backendUser
     * @param session
     * @return
     */
    @RequestMapping("/dolgin")
    public String doLogin(BackendUser backendUser, HttpSession session){
         System.out.println("进入登录");
        BackendUser bu =backendUserService.doLogin(backendUser);
        if (bu!=null){
            session.setAttribute("userInfo",bu);
           return "";
        }
        session.setAttribute("msg","用户或密码错误！");
        return "";
    }
}
